package com.x.crm.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.x.bpm.model.Operation;
import com.x.bpm.model.Rule;
import com.x.bpm.model.StateMap;
import com.x.bpm.rpc.BpmRpcService;
import com.x.framework.controller.BaseController;
import com.x.framework.controller.ResultCode;
import com.x.framework.controller.ResultModel;
import com.x.security.util.Constant;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;



import java.util.List;


@RestController
@RequestMapping("/sysManage")
public class ManageStateController extends BaseController{

	@Reference
	private BpmRpcService bpmRpcService;

	@RequestMapping(value = "/manageStateOpr", method = {RequestMethod.POST, RequestMethod.GET})
	public ResultModel manageStateOpr(String intentionState) {
		StateMap stateMap = new StateMap();
		stateMap.putState("intentionState", intentionState);
		Rule rule = new Rule();
		rule.setApplicationId(Constant.applicationId);
		rule.setProcessId(1); // 意向流程
		List<Operation> operationList = bpmRpcService.selectOperationList(stateMap,rule);
		return new ResultModel(ResultCode.RESULT_SUCCESS, "查询成功", operationList);
	}



}
